[Fix] Fixed syncing of effective fields in plugin framework implementation of share resource - #4969
Conversation
| for j := range planObjects { | ||
| if stateObjects[i].Name == planObjects[j].Name { | ||
| mode.objectLevel(ctx, &stateObjects[i], planObjects[j]) | ||
| finalObjects = append(finalObjects, stateObjects[i]) |
There was a problem hiding this comment.
what happens if the plan as an object which is not in the state? It seems that we are ignoring it.
There was a problem hiding this comment.
Yes, we ignore it because in terraform we want to create the infra from the config
There was a problem hiding this comment.
Can you explain a bit more what is what? I think I am mixing what stateObjects, planObjects and finalObjects are.
As it is, it feels that we are storing (state) a different set of objects that we are creating (plan).
| @@ -446,8 +446,13 @@ func (r *ShareResource) syncEffectiveFields(ctx context.Context, plan, state Sha | |||
| stateObjects, _ := state.GetObjects(ctx) | |||
There was a problem hiding this comment.
Are we suppressing the error? Can this fail?
There was a problem hiding this comment.
if d.HasError() {
panic(pluginfwcommon.DiagToString(d))
}The error isn't suppressed: https://github.com/databricks/terraform-provider-databricks/blob/main/internal/service/sharing_tf/legacy_model.go#L4440.
This was added in: https://github.com/databricks/terraform-provider-databricks/pull/4332/files#diff-5f47d9d2d5e2fcf6b377c528600d81c37f4526da6ce6aba43818bdb0f7039152R2365-R2375
006c174 to
881c81c
Compare
…ricks into panic-share-pluginfw
881c81c to
55e1a33
Compare
…ricks into panic-share-pluginfw
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
| // syncEffectiveFields syncs the effective fields between existingState and newState | ||
| // and returns the newState | ||
| // | ||
| // existingState: infrastructure values that are recorded in the existing terraform state. |
There was a problem hiding this comment.
This corresponds to the state in Read method and plan in the Create/Update methods.
## Release v1.92.0 ### Breaking Changes * Remove stale resources/datasources/documentation related to Clean Room services. * databricks\_permissions resource no longer updates permissions on delete. This is to mitigate an issue with incorrect IS\_OWNER being set ([#5096](#5096)) ### New Features and Improvements * Add `arm` option to `databricks_node_type` instead of `graviton` ([#5028](#5028)) * Add `data_quality_monitor` resource and data sources ([#5092](#5092)). * Add `data_quality_refresh` resource and data sources ([#5092](#5092)). * Perform workspace-level permission assignment by `user_name`, `group_name`, or `service_principal_name` ([#5068](#5068)). ### Bug Fixes * Fixed syncing of effective fields in plugin framework implementation of share resource ([#4969](#4969)) * Mark `storage_location` as read-only in `databricks_catalog` ([#5075](#5075)) ### Documentation * Add instructions for migration from deprecated `databricks_catalog_workspace_binding` to `databricks_workspace_binding` ([#5054](#5054)) * Document output attributes in `databricks_storage_credential` ([#5093](#5093)) ### Internal Changes * Bump the Go SDK to v0.86.0 ([#5092](#5092)).
…efault (#5089) ## Changes <!-- Summary of your changes that are easy to understand --> Make the plugin framework implementation of share resource as default. With this change, `databricks_share` will use the plugin framework implementation. To be merged after: #4969 Note: Removal of SDKv2 implementation will be done in next release so users can fallback to SDKv2 implementation in case there are some issues. ## Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> Integration tests - Applying: SDKv2 -> Plugin Framework - Applying: Plugin Framework -> SDKv2
Changes
Planned objects can be less than the state objects. This can happen when someone removes an object in share resource outside the terraform (for example through UI). The changes fixes the syncing of effective fields by making sure we iterate over the planned and state objects properly.
Ref: #4913
Tests
Integration tests
Unit tests